6. processing and sorting machine generic device integration 6

现在让我们转到桌面站,稍后我们将完成我们的机器,所以让我们在这里离线。
Let's now move on to the table station and later we will have finished our machine, so let's get offline here.

我们只有两台 PlayStation 设备。
We have for the PlayStation only two devices.

一是夹具,一是桌子。
One, that is the the gripper and one that is the table.

那么让我们进入代码吧。
So let's get into the code.

首先,我们将删除这两行代码。
And first of all, we shall remove these two lines of code.

在这里我们只需要激活,你知道,反馈,单一激活设备,所以它应该与我们已经写的非常相似。
And here we just have to activate, you know, feedback, single activation devices, so it should be quite similar to what we already wrote.

所以。
So.

让我们从状态零开始,就像我们对其他站所做的那样,我们需要启用通用设备。
Let's start here in state zero, as we did for the other stations, we needed to enable the generic devices.

所以我们需要做的是让桌子、一个使通用设备等于 true 的设备以及使通用设备等于 true 的桌子抓手设备。
So what we need to do is to have the table, a device that enable a generic device equal to true and the table griper device that enable generic device equal to true as well.

那我们就应该了。
Then we should the.

实际上,在这里,我们需要做一些稍微不同的事情,因为如果我们已经处于一种状态,如果我们已经在桌子上拿起位置传感器,则无需实际激活表并激活。
Actually, here, we need to do something a little bit different, because if we are already in a, uh, in a state in which the if we are already at the table pick up positions sensor, there is no need to actually activate the table and the activated.

所以我们应该做的就是在这里,让我们从状态10开始。
So what we should do is here, let's start from state 10.

看看吧。
And see.

在这里,评估,拾取位置传感器,所以让我们删除它并拥有这个如果表备份位置。
Here, evaluate, pick up position sensor, so let's remove this and have this if table backup position of.

那么我们这里就可以直接进入状态20了。
Then we can get directly to state 20 here.

我们实际上应该将这两个设备启动为禁用状态。
We should actually start both of the devices, um, as disabled.

所以在禁用状态下,意味着设备可以而且应该等于跌落。
So in the state disabled, meaning the device can and should be equal to falls.

所以桌子不会动,团体不会有志气。
So the table will not be moving and the group will not be aspiring.

所以他们将在这里就职。
So here they will pick up positions.

比如说,我们会到达 20 Elsom。
We will get to, say, 20 Elsom.

我们应该到达另一个状态,假设这是状态 15。
We should get to another state, let's say that this is state 15.

这里在状态15,我们需要开始移动桌子,所以在这里我们将,对,开始移动桌子,这意味着我们需要有一个副政府设置通过的桌子设备和桌子设备,重量该设备启用的表设备,该设备状态等于启用。
Here in state 15, we need to start moving the table, so here we will, right, start moving the table, which means that we need to have a table device that the vice government set to through and the table device, the weight for the table device that that device enabled, that device state equal to enabled.

此时,我们会知道桌子正在移动,因此我们可以移动到状态 20。
In this moment, we will know that the table is moving so we can move to state 20.

在状态 20 中,不,我们不要说 20,因为我们已经有了,我们说 17,而不是状态 17。
In state 20, no, let's not say 20, because we already have that, let's say 17 instead states 17.

我们将等待拾取位置传感器。
We will wait for the pick up position senser.

在这里我们会说,如果工作台拾取位置传感器,那么我们将立即停止工作台。
And here we will say that if the table picks up position senser, then we shall immediately stop the table.

因此,我们将右表设备命令等于 Falls 或获取状态,比方说 18,在座位 18 中,我们将实际检查表是否已停止,检查表是否已停止。
So we will right table device command equal to falls or get the state, let's say 18 and in seat 18, we will actually check if the table is stopped, check if table is stopped.

好的。
OK.

所以在这里我们将看到,如果他们愿意,恶习状态等于禁用,那么我们的状态将达到 20。
So here we will have that, if they will, the vice that the vice state is equal to disabled, then our state shall get to 20.

所以20是我们正在等待产品并且桌子与位置对齐的状态。
So 20 is the state where we are waiting for a product and the table is aligned with the position.

所以。
So.

在这里,一旦产品到达,我们就开始遇到第一个实现,我们启动了这个计时器。
Here, as soon as the products arrive, we start we met the first implementation, we started this timer.

实际上,我们在这里可以做的是删除计时器,因为我们已经在设备内部有了计时器,所以让我们删除它。
And actually, what we can do here is remove the timer, because we already have the timer inside the device, so let's remove.

与计时器相关的所有内容,在这里我要说的是,我将启动桌子夹具,因此桌子夹具设备(如果该设备出现)等于 true。
Everything that is related to the timer and here what I will say that I will start the table griper so table griper device, should that device come, is equal to true.

我们等待桌子夹具设备,该设备状态等于以这种方式启用,我们仍然会等待需要重做传感器的时间,但我们将利用计时器和设备。
And we wait for the table griper device, that device state to be equal to enabled in this way, we will still wait for the time that we need to redo the sensor, but we will exploit the timer and the device.

然后我们将到达状态 40,桌子的桌子夹具已准备好并且可以使用,因此我们可以将其移除。
Then we will get to state 40, the table is table griper is ready and able so we can remove this.

而这里我们要开始移动桌子了,所以我们需要分割状态,第一个状态我们要分割桌子,副,不是副,来设置两个开始移动桌子。
And here we will start moving the table, so we need to split the states, the first one in which we have to divide the table, the vice, not the vice, come and set the two to start moving the table.

而如果。
And if.

表设备的设备状态等于此处启用的状态。
The table device gets to a device state equal to enabled then here.

我们实际上可以移动到状态45,其中桌子正在移动到这里,我们等待传感器我,这意味着我们已经到达了。
We can actually move to a state 45 in which the table is moving here, we wait for the wait for senser me, that means that we have arrived.

所以首先,当我们到达这个位置时,我们将停止桌子。
So first, when we get to this position, we will stop the table.

因此表副和应等于落和。
So table the vice that the vice and should be equal to falls and.

这里。
Here.

让我们在状态 48 中也需要有一个中间状态,我们将在这里拥有它,等待表停止。
Let's we need to have an intermediate state as well here in state 48, we will have it here, wait for the table to stop.

所以在这里,如果表中的副机状态等于禁用,那么这里我们可以移动到状态 50,在该状态下我们将发布产品。
So here, if the table, the vice that the vice state is equal to disabled, then here we can move to state 50 in which we will release the product.

所以这里我们使用了计时器。
So here we were using the timer.

我们可以实现类似于我们在这里所做的事情并说 30。
We can implement something similar to what we did here and say 30.

我将删除颜色声明,在这里我们需要将夹具设置为强制并建议状态检查设备状态以将其禁用。
I will remove the color statement and here we need to set the gripper to force and advise state to check for the device state to get it to be disabled.

一旦我们这样做了。
Once we have done that.

我们需要到达。
We need to get to the.

初始状态 抱歉这个初始位置,这意味着我们需要获得状态 15。
Initial state to this sorry to this initial position, and this means that we need to get the state 15.

我们要搬进去的就是那间。
There was the one in which we were moving.

将工作台朝向拾取位置,传感器。
The table toward the pick up position, senser.

好的,所以我认为我们现在以正确的方式管理正确的状态机,我们需要继续研究停止状态和紧急管理。
OK, so I think we manage the right the the state machine in the correct way right now, we need to move on and look at the stopping state and the emergency management.

因此,对于紧急情况,我们对其他车站做了同样的事情。
So for the emergency, the same thing that we did for the other the other stations.

因此,启用通用设备的桌面设备应该等于跌落,启用通用设备的桌面夹具设备也应该等于力。
So table device that enabled generic devices should become equal to falls and the table griper device that enable generic devices should become equal to force as well.

然后我们需要管理停止,所以。
Then we need to manage the stop, so.

我们需要做的是。
What we need to do is.

这里,我们需要检查一下。
Here, we need to check.

表格在哪里,这是正确的,我们还需要确定这一点。
Where the table is, and this is correct, and we need also to be sure that.

表设备已停止,因此应强制调用设备状态。
The table device is stopped, so device state should be called to force.

如果这意味着桌子是静止的并且位于正确的位置上,那么该工资应该等于残疾。
And that salary should be equal to disabled if this means that the table is still and it is on a set on the correct position.

和。
And.

如果我们在那里的话。
If we are there.

事实上,这从一开始就是不正确的,所以我们实际上需要处于正确的颜色或较弱的位置。
Actually, this was not correct in the first place, so we actually need to be on the correct color or at the weaker position.

所以这里我们需要,嗯,有正确的颜色对应。
So here we need to, um, have the correct the color correspondance.

因此,如果颜色是蓝色,我们需要位于峰值位置或蓝色下降位置。
So we need to be either at the peak of position or at the blue drop position if the color is blue.

所以在这里我将写下颜色和对立面,或者在这里我们需要在红色道具上。
So here I will write color and the opposition or here we need to be on the red prop..

所以这里我们没有颜色。
So here we have not color.

还有这里的另一个支架。
And the other bracket here.

所以如果我们达到了这个状态应该没问题。
So this should be fine if we have reached this state.

说一千,然后我们还需要禁用抓手。
State one thousand, and then we also needed to disable the griper.

所以我们需要做的是,当我们在这里时,我们拥有,嗯,。
So what we need to do is when we are here, we have, um, the.

台钳,副台钳那里的副车应设置为 false,并且只有当台钳,台钳,副台状态等于禁用时,然后我们才可以返回到状态,然后说零,抱歉并添加如果在这里,好吧,我们几乎完成了这里的所有事情,我们可以删除不再使用的计时器,并且我们需要检查表无法停止的状态。
Table griper, the vice that the vice carment there shall be set to false and only if the table griper, the vice that the vice state is equal to disabled, then we are allowed to move back to state then to say zero, sorry and add and and if over here, OK, we managed to do almost everything here, we can remove the timer that we are no longer using and we need to check for the states in which the table cannot be halted.

无法保持,抱歉,这意味着桌子正在移动,让我们看看。
Cannot be held, sorry, and this means where the table is moving and let's see.

15 号州际公路,桌子在移动。
Interstate 15, the table is moving.

17、18、19,应该停止,所以15到17之间不行,然后我们有40 45。
And 17, 18, 19, it should be stopping, so between 15 and 17 are not OK, then we have a 40 45.

好的,所以 15, 17, 14, 45,所以这里我们将有不等于 15 的状态和不等于 17 的状态,不等于 40 的状态和不等于 45 的状态。
OK, so 15, 17, 14, 45, so here we will have state not equal to 15 and states not equal to 17 and state not equal to 40 and the state not equal to forty five.

所有其他州都应该可以顺利进行。
All the other states should be good to go.

四十八还可以。
Forty eight is OK.

是的。
Yes.

好的,所以我想一切都好,我们终于可以测试我们用基因装置方法实现的完整机器了。
OK, so I guess everything is OK and we can finally test our complete machine that has been realized with the genetic device approach.

那么我们来进行下载吧。
So let's carry out to download.

让我们启动程序,启动机器,看看从头到尾一切是否运行正确。
Let's start the program and let's start the machine and let's see if everything runs correctly from the beginning to the end.

好的。
OK.

该表目前看来运行良好。
The table seems to work fine for now.

是的。
Yes.

它停在正确的位置。
It stops at the correct positions.

它等待了半秒钟。
And it waits for half a second.

是的,我猜名义上的名义功能很好并且工作得很好。
Yes, I guess the nominal the nominal functioning is good and works pretty good.

和。
And.

让我们尝试一下坚持一下。
Let's try some hold.

在一些令人讨厌的职位上。
In some nasty positions.

好的,这很好。
OK, this is good.

让我们再试一次。
Let's try it again.

是的,看起来不错。
Yes, seems fine.

好吧,让我们再坚持一下。
Well, let's hold again.

好吧,也许有一件事是关闭的,我在这里看到电工仍然在工作,即使产品到达了桌子,也许我们可以在钻孔站改变这一点。
OK, maybe one thing is off, I see here that the electrician stays on, even if the products arrived at the table, maybe we can change that in the drilling station.

整个州是 90,呃,抱歉。
The whole state is 90 in which, uh, sorry.

呃嗯,表格条目。
Uh hmm, table entry.

如果国家是90,我猜是这样。
If the state was 90, I guess that.

它应该已经禁用了这个,让我们看看,个性化,是的,90 对于练习来说不是一个好的状态。
It should have already disabled this, let's see, individualisation, yes, 90 isn't a good state for the drill.

所以我们在这里添加它。
So let's add it here.

和 状态下的钻孔站必须不同于 90。
The drilling station at and state must be different from 90.

这对我们来说应该是有好处的。
And this should be good for us.

也许我们犯过这样的错误。
Maybe we I made some sorts of mistakes like this.

也许通过演习,让我们仔细看看,让我们现在看看。
Maybe with the drill, let's see well, let's see now.

老的。
Old.

是的,我想演习也仍在继续。
Yes, I guess the drill remains on as well.

所以我们实际上可以调查这一点,因为对于演习来说,我也猜想我并没有认为这里的状态,呃,状态 45 是一个坏状态,但我应该这样做。
So we can actually look into that because for the drill, I also guess that I didn't consider here state, uh, state 45 as a bad one, but I should have.

是的,在这里。
Yes, here.

而且国家不设防。
And the state is not fortified.

好的。
OK.

所以我们删除了旧的,我将再次尝试,阈值年,看看空气是否停止。
So we removed the old and I will try this again, the thresholding year to see if the air stops.

是的,这就是我们想要的。
Yes, that's what we wanted.

我们现在就试试吧。
Let's try now.

是的,钻头停止并且位置正确。
Yes, the drill stops and the correct position.

好的,所以我想我们可以尝试一些紧急情况,是的,你是。
OK, so I guess that for let's try some emergency, yes, you're.

好吧,这对人们来说似乎不错,有一个我们没有尝试过。
OK, it seems fine for the people, there was one that we didn't try.

我们也尝试在一些奇怪和不方便的位置停下来。
Let's also try some stop in some weird and inconvenient positions.

而且我知道,也许用这种方式编写代码可能看起来更复杂。
And I know that maybe it may seem more complicated to write code in this way.

压力停止了,抱歉。
The stress stop, sorry.

呃。
Uh.

是的,所以停止是错误的。
Yes, so the stop is wrong.

正如我们所看到的,桌子一直在旋转。
As we can see, that the table keeps spinning.

让我看看为什么我们处于状态一百。
Let me see why we are in a state one hundred.

和。
And.

哦,是的,当然,该表永远不会自行禁用,因此我们需要在这里为该表做一些不同的事情,因为如果我们到达该位置。
Oh, yes, of course, the table will not ever be disabled on its own, so we need to do something different here for the table because if we get there to that position.

我们需要禁用工作台和夹具,并确保它们都被禁用。
We need to disable both the table and the gripper and be sure that both of them are disabled.

所以是的,我将写入表设备,该设备状态等于禁用。
So yea, I will write and the table device, that device state equal to disabled.

让我们试试这个,上网,让我们看看桌子,桌面,。
Let's try this, go online and let's see the table, the desktop, the.

是的,它已经发布了,并且已经发布了它们的产品。
Yes, it has, and it has released the product they're.

所以这很棒。
So this is great.

我是说,也许我们可能会觉得你的代码比需要的稍微复杂一点,但实际上你可以看到所有这些代码都独立于设备的架构。
I was saying that maybe we may seem strange for your code to be a little bit more complicated than needed, but actually you can actually see that all this code is independent from the architecture of the devices.

所以这个设备中的任何一个都可以改变。
So any of this device can change.

好吧,你可能有一些非常不同的东西,但车站的逻辑可能保持不变。
Well, you may have something very different, but the logic of the station may remain the same.

所以这是非常强大的并且会加快你的编程速度。
So this is quite powerful and will speed up your programming.

如果您正在执行彼此类似的应用程序,那么您可以,呃,以非常快的方式对您的公司或您的客户进行修改。
If you're doing similar application one to another, it will allow you to have, uh, to make modifications in a very fast way or either your company or your customers.

使用这样的一些工具,你会变得更有效率。
And you will be much more efficient with some tools like this.

我想向您传达的信息是,模块化是需要在工具开发中付出相当大的努力的东西,但稍后,它将为您加快一切速度。
The message that I want to pass on you is that modularity is something that requires quite an effort in the development of the tools, but later on, it will speed everything up for you.

所以我们设法让这台机器正常工作。
So we managed to get this machine working.

在下一个视频中,我们将研究机器和设备的折叠控制器。
In the next video, we will look into the fold controller for or for the machine and the device.

所以我们需要管理故障。
So we need to manage the faults.

正如您所记得的,我们这里有一个错误的可视化,这将使我们能够强制机器中任何传感器或执行器的值。
And as you recall, we have here a faulty visualization that will allow us to force the values of any sensor or actuator in the machine.

所以在接下来的几个视频中,我们也会用到这个。
So in the next few videos, we will also use this.